package mypractice;

public class Leetcode389 {
    public char findTheDifference(String s, String t) {

        int[] sCount = new int[26];
        int[] tCount = new int[26];
        int sLen=s.length();
        int tLen=t.length();
        int i;
        for(i=0;i<sLen;i++){
            sCount[s.charAt(i)-'a']++;
        }
        for(i=0;i<tLen;i++){
            tCount[t.charAt(i)-'a']++;
        }
        for(i=0;i<26;i++){
            if(sCount[i]!=tCount[i]){
                return (char) (i+'a');
            }
        }
        return (char) (i+'a');
    }
}
